<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@page contentType="text/html;charset=utf-8" isELIgnored="false" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <title>用户列表</title>
    <link rel="icon" href="${base}/favicon.ico" type="image/ico">
    <link href="${base}/css/bootstrap.min.css" rel="stylesheet">
    <link href="${base}/css/materialdesignicons.min.css" rel="stylesheet">
    <link href="${base}/css/style.min.css" rel="stylesheet">
    <style>
        .myHead{
            width: 40px;
            height: 40px;
            border-radius: 50%;
        }
    </style>
</head>

<body>
<div class="container-fluid">

    <div class="row">
        <div class="col-lg-12">
            <div class="card">
                <div class="card-toolbar clearfix">
                    <%--          <form class="pull-right search-bar" method="get" action="#!" role="form">--%>
                    <%--            <div class="input-group">--%>
                    <%--              <div class="input-group-btn">--%>
                    <%--                <input type="hidden" name="search_field" id="search-field" value="title">--%>
                    <%--                <button class="btn btn-default dropdown-toggle" id="search-btn" data-toggle="dropdown" type="button" aria-haspopup="true" aria-expanded="false">--%>
                    <%--                <span class="caret"></span>--%>
                    <%--                </button>--%>
                    <%--                <ul class="dropdown-menu">--%>
                    <%--                  <c:forEach var="u" items="${titletypes}">--%>
                    <%--                  <li> <a tabindex="-1" href="javascript:void(0)" data-field="cat_name">${u.type}</a> </li>--%>
                    <%--                  </c:forEach>--%>
                    <%--                </ul>--%>
                    <%--              </div>--%>
                    <%--              <input type="text"  class="form-control" value="" name="keyword" placeholder="请输入名称">--%>
                    <%--            </div>--%>
                    <%--          </form>--%>
                    <div class="toolbar-btn-action">
<%--                        <a class="btn btn-primary m-r-5" href="${base}/exam/toAddExam"><i class="mdi mdi-plus"></i> 新增</a>--%>
<%--                        <a class="btn btn-danger" onclick="delAll()"><i class="mdi mdi-window-close"></i> 删除</a>--%>
                        <%--                           <form action="/tac/titleAdmin" id="fm2" style="display: inline-block">--%>
                        <%--                            搜索:--%>
                        <%--                            <select class="btn btn-primary m-r-5" name="titleSearch" id="select">--%>
                        <%--                              <option value="0">全部</option>--%>
                        <%--                              <c:forEach var="u" items="${titletypes}">--%>
                        <%--                                <option value="${u.id}"  <c:if test="${u.id eq titleSearch}">selected</c:if>>${u.type} </option>--%>
                        <%--                              </c:forEach>--%>
                        <%--                            </select>--%>
                        <%--                           </form>--%>
                        <form action="${base}/exam/classExam" id="form1" method="post" style="display:inline-block;">
                            <input type="hidden" name="classid" value="${theUser.classid}">
                            <input id="km" type="text" class="btn btn-success m-r-5" name="subject" value="${subject}"  placeholder="科目名搜索" onblur="kmm()">
                        </form>
    <a class="btn btn-success m-r-5" href="${base}/exam/toIndex">返回首页</a>
                    </div>
                </div>
                <div class="card-body">
                    <form action="" method="post" id="fm">
                        <div class="table-responsive">
                            <table class="table table-bordered">
                                <thead>
                                <tr>
<%--                                    <th>--%>
<%--                                        <label class="lyear-checkbox checkbox-primary">--%>
<%--                                            <input type="checkbox" id="check-all"><span></span>--%>
<%--                                        </label>--%>
<%--                                    </th>--%>
                                    <th>试卷编号</th>
                                    <th>试卷名</th>
                                    <th>科目</th>
                                    <th>考试开始试卷</th>
                                    <th>考试时长</th>
                                    <th>总分</th>
                                    <th>选择题数量</th>
                                    <th>选择题分值</th>
                                    <th>班级id</th>>
                                </tr>
                                </thead>
                                <tbody>
                                <c:forEach var="u" items="${p.list}">
                                    <tr>
<%--                                        <td>--%>
<%--                                            <label class="lyear-checkbox checkbox-primary">--%>
<%--                                                <input type="checkbox" name="ids" value="${u.id}"><span></span>--%>
<%--                                            </label>--%>
<%--                                        </td>--%>
                                        <td>${u.id}</td>
                                        <td>${u.name}</td>
                                        <td>${u.subject}</td>
                                        <td>
                                            <fmt:formatDate value="${u.begintime}" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate>
                                        </td>
                                        <td>${u.timelength}</td>
                                        <td>${u.allscore}</td>
                                        <td>${u.choicenum}</td>
                                        <td>${u.choicescore}</td>
                                        <td>${theUser.classid}</td>
                                        <td>
                                            <div class="btn-group">
                                                <a class="btn btn-xs btn-default layui-btn layui-btn-sm layui-btn-danger" href="${base}/exam/myExamTest?examid=${u.id}">考试</a>
                                            </div>
                                        </td>
                                    </tr>
                                </c:forEach>
                                </tbody>
                            </table>
                        </div>
                    </form>
                    <ul class="pagination">
                        <li><span><a href="${base}/exam/classExam?pageNum=1&subject=${subject}&classid=${theUser.classid}">«</a></span></li>
                        <li><span><a href="${base}/exam/classExam?pageNum=${p.prePage}&subject=${subject}&classid=${theUser.classid}">上一页</a></span></li>
                        <c:forEach var="i" items="${p.navigatepageNums}">
                            <li <c:if test="${i eq p.pageNum}">class="active"</c:if> ><a href="${base}/exam/classExam?pageNum=${i}&subject=${subject}&classid=${theUser.classid}">${i}</a></li>
                        </c:forEach>
                        <li><span><a href="${base}/exam/classExam?pageNum=${p.nextPage}&subject=${subject}&classid=${theUser.classid}">下一页</a></span></li>
                        <li><a href="${base}/exam/classExam?pageNum=${p.pages}&subject=${subject}&classid=${theUser.classid}">»</a></li>
                    </ul>
                </div>
            </div>
        </div>

    </div>

</div>

<script type="text/javascript" src="${base}/js/jquery.min.js"></script>
<script type="text/javascript" src="${base}/js/bootstrap.min.js"></script>
<script type="text/javascript" src="${base}/js/perfect-scrollbar.min.js"></script>
<script type="text/javascript" src="${base}/js/main.min.js"></script>
<script type="text/javascript">
    $(function(){
        $('.search-bar .dropdown-menu a').click(function() {
            var field = $(this).data('field') || '';
            $('#search-field').val(field);
            $('#search-btn').html($(this).text() + ' <span class="caret"></span>');
        });
    });

</script>
<script>
    if (${!empty error}) {
        lightyear.loading('show');
        // 假设ajax提交操作
        setTimeout(function () {
            lightyear.loading('hide');
            lightyear.notify('${error}', 'danger', 0);
        }, 0)
    } else {
        if (${!empty success}) {
            lightyear.loading('show');
            // 假设ajax提交操作
            setTimeout(function () {
                lightyear.loading('hide');
                lightyear.notify('${success}', 'success', 0);
            }, 0)
        }
    }
</script>
<script>
    function sjm() {
        $("#form1").submit();
    }
    function kmm() {
        $("#form1").submit();
    }
    function delAll() {
        var  i = false;
        $("input[name='ids']").each(
            function () {
                if(this.checked) i = true;
            }
        )
        if(i){
            $("#fm").attr("action", "${base}/exam/deleteAllExam");
            $("#fm").submit();
        }
    }

    $("#select").change(function () {
        $("#fm2").submit();
    })
</script>
</body>
</html>